﻿using System;
using CI.Mesopotamia;
using CI.Mesopotamia.WebService;
using CI.Organism;
using NUnit.Framework;

namespace MesopotamiaDCProxy.SystemTests
{
    [TestFixture]
    public class OrganismsTests
    {
        private InboundClient _wsClient;
        private int _userid;
        const string HostVersion = "hostVersion";
        const string MachineName = "machineName";

        [SetUp]
        public void Setup()
        {
            _wsClient = new InboundClient();
            _userid = _wsClient.GetNewUserId(MachineName, HostVersion);
        }

        [Test]
        public void LoadOrganism()
        {
            SaveScenario();
            var organisms = _wsClient.GetScenarioOrganisms("Clean My House", 0, int.MaxValue);
            var dalLoaded = _wsClient.LoadDal("Clean My House", _userid, 1, new Guid[] {organisms.Organisms[0].Guid});
            Assert.IsNotNull(dalLoaded, "Organism not loaded from db");
        }

        private void SaveScenario()
        {
            var scenario = new ScenarioTests();
            scenario.Setup();
            scenario.SaveScenarioCleanMyHouseWS();
        }
    }
}
